package com.tang.websocket.v1.session;

import com.tang.websocket.v1.message.WebSocketMessage;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Map;

/**
 * @author Tang
 * @classname WebSocketSession
 * @description [ Session 包装 ]
 * @date 2022/11/25 16:59
 */
public interface WebSocketSession extends Cloneable {

    /**
     * getId
     * @return
     */
    String getId();

    /**
     * sendMessage
     * @param message
     * @throws IOException
     */
    void sendMessage(WebSocketMessage<?> message) throws IOException;

    /**
     * getAttributes
     * @return
     */
    Map<String, Object> getAttributes();

    /**
     * getPathParameters
     * @return
     */
    Map<String,String> getPathParameters();

    /**
     * getLocalAddress
     * @return
     */
    InetSocketAddress getLocalAddress();

    /**
     * getRemoteAddress
     * @return
     */
    InetSocketAddress getRemoteAddress();

    /**
     * isOpen
     * @return
     */
    boolean isOpen();

    /**
     * close
     * @throws IOException
     */
    void close() throws IOException;

}